package util;

import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

public class ModeloTablaAgenda extends AbstractTableModel {

	private static final long serialVersionUID = 1L;
	@SuppressWarnings("unused")
	private int row, column=6;
	private List<FilaAgenda> tabla;
	
	public ModeloTablaAgenda (){
		row=0;
		tabla = new ArrayList<FilaAgenda>();
	}
	
	public ModeloTablaAgenda (int r){
		this.row = r;
		tabla = new ArrayList<FilaAgenda>();
	}
	
	public int getRowCount() {
		return tabla.size();
	}
	
	public int getColumnCount() {
		return column;
	}
	
	public Object getValueAt(int rowIndex, int columnIndex) {
		return tabla.get(rowIndex).getValorCelda(columnIndex);
	}
	
	public void setValueAt(int rowIndex, int columnIndex, Object value) {
		switch (columnIndex){
			case 0:
				tabla.get(rowIndex).setHorario((String)value);
				break;
			case 1:
				tabla.get(rowIndex).setEstado((String)value);
				break;
			case 2:
				tabla.get(rowIndex).setNombre((String)value);
				break;
			case 3:
				tabla.get(rowIndex).setApellido((String)value);
				break;
			case 4:
				tabla.get(rowIndex).setTelefono((String)value);
				break;
			case 5:
				tabla.get(rowIndex).setObraSocial((String)value);
				break;
			default:
				break;
		}
	}
}
